<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>金字塔</title>
          <style>
          *{
            margin:0;
            padding:0;
          }
          div{
            text-align:center;
            color:orange;
          }
          </style>
</head>
<body>
          <div id='mydiv'></div>
          <script>
           var mydiv = document.getElementById('mydiv');
           var html='';
           for (var i=1;i<=6;i++) {
            for (var o=1;o<=2*i-1;o++) {
                html+=' *';
            }
            html+='<br>';
           }
           mydiv.innerHTML=html;
          </script>
    
</body>
</html>